// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IPicknPlaceObjectGrip.cs" company="Microsoft Corporation">
// The MIT License (MIT)
// 
// Copyright (c) 2014, Microsoft Corporation
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Microsoft.Robotics.Manipulation.PicknPlace
{
    using System;
    using System.Collections.Generic;
    using Microsoft.Robotics.Numerics;
    using Microsoft.Robotics.PhysicalObjects;

    /// <summary>
    /// Interface for retrieving grasp information about a pick and place object
    /// </summary>
    public interface IPicknPlaceObjectGrip : IEnumerable<GripStyle>, IEnumerator<GripStyle>
    {
        /// <summary>
        /// Gets the description of the object
        /// </summary>
        PhysicalObjectDescription ManipulatedObjectDescription { get; }

        /// <summary>
        /// Returns the palm plane for a grip style
        /// </summary>
        /// <param name="gripStyle">The grip style</param>
        /// <param name="objectPose">Object's pose</param>
        /// <returns>plane normal direction and distance from origin</returns>
        Vector4 GetPalmPlane(GripStyle gripStyle, Pose objectPose);

        /// <summary>
        /// Get the grip axis - the long axis orientation between grip fingers
        /// </summary>
        /// <param name="gripStyle">The grip style</param>
        /// <param name="objectPose">Object's pose</param>
        /// <returns>The grip axis</returns>
        Vector3 GetGripAxis(GripStyle gripStyle, Pose objectPose);

        /// <summary>
        /// Gets the centre point of the grip along the axis
        /// </summary>
        /// <param name="gripStyle">The grip style</param>
        /// <param name="objectPose">Object's pose</param>
        /// <returns>Center grip point</returns>
        Vector3 GetGripCenter(GripStyle gripStyle, Pose objectPose);

        /// <summary>
        /// Obtain a set of equivalent grip styles. Grip styles in an
        /// equivalent set can be pick or placed with out having to physically
        /// change grip. For example Grip from top or grip from bottom can be equivalent
        /// for a symmetric object
        /// </summary>
        /// <param name="gripStyle">Sample element for equivalent set</param>
        /// <returns>Set of equivalent grip styles</returns>
        IEnumerable<GripStyle> GetEquivalentGripStyleSet(GripStyle gripStyle);

        /// <summary>
        /// Gets an estimate of the position of the horizontal "table" surface from the object pose
        /// This is a temporary approach to obstacle (surface) avoidance. It will be replaced by 
        /// a more comprehensive obstacle avoidance
        /// </summary>
        /// <param name="objectPose">Object pose</param>
        /// <returns>Distance to the horizontal surface</returns>
        double GetHorizontalPlaneOffset(Pose objectPose);

        /// <summary>
        /// Gets a suggested gripper opening in M for the grip style
        /// </summary>
        /// <param name="gripStyle">grip style</param>
        /// <returns>Grip style</returns>
        double GetGripperOpeningInM(GripStyle gripStyle);
    }
}
